import './index.css'
import {useSelector} from 'react-redux'
import React from 'react'
import Imgpro from '../Drawdesigns/Imgpro/imgpro'
const Right = ({ fontSize, color, bold, updateTextStyle }) => {
     const selectedItem = useSelector((state) => state.items.items.find(item => item.id === state.items.selectedItemId));

     const items=useSelector((state) => state.items.items)
     console.log(items,'0000')
   
    //  const selectedItem = items[items.length - 1];
    return (
        <div>
    
    <div>
            <h3>文本编辑</h3>
            <div className='chu'>
                <button onClick={() => updateTextStyle('bold')}>加粗</button>
                <div>是否加粗：{selectedItem?.bold? '是' : '否'}</div>
            </div>
            <div className='maxmin'>
                <button onClick={() => updateTextStyle('increaseFontSize')}>放大</button>
                <div>{selectedItem?.fontSize || fontSize}</div>
                <button onClick={() => updateTextStyle('decreaseFontSize')}>缩小</button>
            </div>
            <div className='color'>
                <input type="color" onChange={(e) => updateTextStyle('setColor', e.target.value)} />
                <div>当前颜色：{selectedItem?.color || color}</div>
            </div>
           
         
         
      </div>
      <Imgpro />
    </div>
    );
};

export default Right;